#include <iostream>
#include <stack>
#include <vector>
#include <functional>
using namespace std;

int main()
{
	int row, col; cin >> row >> col;
	int s_r, s_c, e_r, e_c;
	cin >> s_r >> s_c >> e_r >> e_c;
	vector<vector<int>> arr(row, vector<int>(col));
	auto visited = arr;
	for (auto& r : arr) for (auto& c : r) cin >> c;
	int dx[4] = { 0, 0, -1, 1 };
	int dy[4] = { -1, 1, 0, 0 };
	stack<pair<int, int>> path;
	function<bool(int, int)>
	dfs = [&](int r, int c) {
		if (r == e_r && c == e_c) {
			path.push({ r, c });
			return true;
		}
		visited[r][c] = 1;
		for (int i = 0; i < 4; i++) {
			int x = r + dx[i], y = c + dy[i];
			if (x < 0 || x >= row || y < 0 || y >= col || arr[x][y] || visited[x][y]) {
				continue;
			}
			if (dfs(x, y)) {
				path.push({ r, c });
				return true;
			}
		}
		visited[r][c] = 0;
		return false;
	};
	if (dfs(s_r, s_c)) {
		while (path.size()) {
			for (int i = 0; i < 4; i++) {
				printf("(%d,%d)", path.top().first, path.top().second);
				path.pop();
				if (path.size()) cout << "->";
				else return 0;
			}	cout << '\n';
		}
	}
	else {
		cout << "No Path";
	}
	return 0;
}